package com.example.site.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.util.SaResult;
import com.example.site.entity.Type;
import com.example.site.service.TypeService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("/api/type")
public class TypeController {
    @Resource
    private TypeService typeService;

    /**
     * @param type
     * @return
     * @deprecated 创建房间类型
     */
    @SaCheckLogin
    @PostMapping("/create")
    public SaResult create(@RequestBody Type type) {
        return typeService.create(type);
    }

    /**
     * @param data
     * @return
     * @deprecated 房间类型查询
     */
    @SaCheckLogin
    @GetMapping("/list")
    public SaResult list(@RequestParam Map<String, String> data) {
        return typeService.getList(data);
    }

    /**
     * @param
     * @return
     * @deprecated 编辑
     */
    @SaCheckLogin
    @PostMapping("/edit")
    public SaResult edit(@RequestBody Type type) {
        return typeService.edit(type);
    }
}
